package com.moyq5.mvc.maker.test.bean.custom;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;

import com.moyq5.mvc.maker.test.bean.enums.SysNotifyStatus;

/**
 * 需要有通知记录的的实体抽象类
 * @author Moyq5
 * @date 2018年9月5日
 */
@MappedSuperclass
public abstract class NotifyEntity extends QueryEntity {

	private static final long serialVersionUID = 1L;
	
	/**
	 * 通知状态
	 */
	@Enumerated(EnumType.ORDINAL)
    @Column(name = "notify_status", columnDefinition="int(1) not null default '0'")
	private SysNotifyStatus notifyStatus;
	/**
	 * 已通知次数
	 */
	@Column(name = "notify_count", nullable = false, precision = 8, scale = 0, columnDefinition = "int(8) default '0'")
	private Integer notifyCount;
	/**
	 * 剩余通知次数
	 */
	@Column(name = "notify_remain", nullable = false, precision = 8, scale = 0, columnDefinition = "int(8) default '0'")
	private Integer notifyRemain;
	/**
	 * 下次通知时间
	 */
	@Column(name = "notify_time", nullable = false, columnDefinition = "datetime default '1970-01-01 00:00:00'")
	private Date notifyTime;
	/**
	 * （开放接口）客户单号
	 */
	@Column(name = "cus_order_no", length = 30)
	private String cusOrderNo;
	/**
	 * （开放接口）通知地址
	 */
	@Column(name = "cus_notify_url", length = 200)
	private String cusNotifyUrl;
	/**
	 * （开放接口）备注信息
	 */
	@Column(name = "cus_remark", length = 200)
	private String cusRemark;
	@PrePersist
	public void prePersist() {
		super.prePersist();
		if (null == notifyStatus) {
			notifyStatus = SysNotifyStatus.NEW;
		}
		if (null == notifyCount) {
			notifyCount = 0;
		}
		if (null == notifyRemain) {
			notifyRemain = 10;
		}
		if (null == notifyTime) {
			notifyTime = new Date();
		}
	}

	public SysNotifyStatus getNotifyStatus() {
		return notifyStatus;
	}

	public void setNotifyStatus(SysNotifyStatus notifyStatus) {
		this.notifyStatus = notifyStatus;
	}

	public Integer getNotifyCount() {
		return notifyCount;
	}

	public void setNotifyCount(Integer notifyCount) {
		this.notifyCount = notifyCount;
	}

	public Integer getNotifyRemain() {
		return notifyRemain;
	}

	public void setNotifyRemain(Integer notifyRemain) {
		this.notifyRemain = notifyRemain;
	}

	public Date getNotifyTime() {
		return notifyTime;
	}

	public void setNotifyTime(Date notifyTime) {
		this.notifyTime = notifyTime;
	}

	public String getCusOrderNo() {
		return cusOrderNo;
	}

	public void setCusOrderNo(String cusOrderNo) {
		this.cusOrderNo = cusOrderNo;
	}

	public String getCusNotifyUrl() {
		return cusNotifyUrl;
	}

	public void setCusNotifyUrl(String cusNotifyUrl) {
		this.cusNotifyUrl = cusNotifyUrl;
	}

	public String getCusRemark() {
		return cusRemark;
	}

	public void setCusRemark(String cusRemark) {
		this.cusRemark = cusRemark;
	}

}